home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / srcbkvt.zip / JAVA.ASC < prev    next >
Text File  |  1996-07-08  |  24KB  |  627 lines

  1. _Visual Development Tools for Java_
  2. by Steve V. Yalovitser
  3.  
  4. Listing One
  5. // drdobbs.java - 
  6. // Version - 1.0
  7. // zpb_begin Revisions 
  8. // zpb_end 
  9.  
  10. import java.awt.*;
  11. import java.util.*;
  12. import java.applet.Applet;
  13. import LogFontLayout;  // Fixed position layout based on font size
  14.  
  15. // zpb_begin UserImports 
  16. // zpb_end 
  17.  
  18.  
  19. class SampleGenCodePane1 extends Canvas {
  20.     private static Applet applet;
  21.  
  22.  
  23.    // zpb_begin SampleGenCodePane1UserVars 
  24.     // zpb_end 
  25.  
  26.     public SampleGenCodePane1(Applet app) {
  27.         applet = app;
  28.  
  29.         // zpb_begin SampleGenCodePane1Constructor 
  30.         // zpb_end 
  31.     }
  32.     public void paint(Graphics g) {
  33.         Dimension d = size();
  34.         g.drawRect(0,0,d.width-1,d.height-1); // border
  35.         // zpb_begin SampleGenCodePane1Paint 
  36.         // zpb_end 
  37.     }
  38.  
  39.     // zpb_begin SampleGenCodePane1UserMethods 
  40.     // zpb_end 
  41. }
  42.  
  43.  
  44. public
  45. class drdobbs extends Applet {
  46.  
  47.     private static Applet applet;
  48.     Label pStatic1;
  49.     Button pButton1;
  50.     Checkbox pRadioButton1;
  51.     CheckboxGroup pRadioButton1Group;
  52.     SampleGenCodePane1 pPane1;
  53.  
  54.     // Initial size in logical units
  55.     Dimension initialSize = new Dimension(291, 172);
  56.     // zpb_begin SampleGenCodeUserVars 
  57.     // zpb_end 
  58.  
  59.     public
  60.     void init() {
  61.         applet = this;
  62.  
  63.         // zpb_begin AppletInit 
  64.         // zpb_end 
  65.  
  66.         setBackground(Color.lightGray);
  67.         setFont(new Font("Helvetica", Font.PLAIN, 12));
  68.         LogFontLayout lfLayout = new LogFontLayout(this);
  69.         setLayout(lfLayout);
  70.  
  71.         pButton1 = new Button("Button");
  72.         add("32 19 66 48", pButton1);
  73.         pStatic1 = new Label("Text");
  74.         add("133 20 22 42", pStatic1);
  75.         pRadioButton1Group = new CheckboxGroup();
  76.         pRadioButton1 = new Checkbox("Radio", pRadioButton1Group, false);
  77.         add("207 22 35 24", pRadioButton1);
  78.  
  79.        pPane1 = new SampleGenCodePane1(applet);
  80.         add("74 83 79 50", pPane1);
  81.  
  82.         // zpb_begin SampleGenCodeConstructor_2 
  83.         // zpb_end 
  84.  
  85.         // Size in logical units
  86.         resize(getLayout().preferredLayoutSize(this));
  87.  
  88.         // zpb_begin SampleGenCodeConstructor_3 
  89.         // zpb_end 
  90.     }
  91.  
  92.     public Dimension minimumSize() {
  93.         // zpb_begin SampleGenCodeMinimumSize 
  94.         // zpb_end 
  95.             
  96.         LayoutManager layoutMgr = getLayout();
  97.         if (layoutMgr instanceof LogFontLayout) { 
  98.             // Convert from logical units to absolute coordinates
  99.             int w = initialSize.width;
  100.             int h = initialSize.height;
  101.             LogFontLayout layout = (LogFontLayout)layoutMgr;
  102.             return new Dimension(layout.duX(w), layout.duY(h));
  103.         } 
  104.         return new Dimension(initialSize);
  105.     }
  106.  
  107.     public boolean handleEvent(Event e) {
  108.  
  109.         // zpb_begin SampleGenCodeHandleEvent 
  110.         // zpb_end 
  111.  
  112.         return super.handleEvent(e);
  113.     }
  114.  
  115.     public Frame getFrame(Container c) {
  116.         // zpb_begin AppletGetFrame 
  117.         // zpb_end 
  118.         if (c instanceof Frame || c == null)
  119.             return((Frame)c);
  120.           else 
  121.             return(getFrame(c.getParent()));
  122.     }
  123.  
  124.     public boolean action(Event evt, Object obj) {
  125.         if (evt.target == pButton1) {
  126.             // zpb_begin SampleGenCodeButton1Clicked 
  127.             // zpb_end 
  128.         }
  129.  
  130.         // zpb_begin SampleGenCodeAction 
  131.         // zpb_end 
  132.  
  133.         return true;
  134.  
  135.    }
  136.  
  137.  
  138.     // zpb_begin SampleGenCodeAppletUserMethods 
  139.     // zpb_end 
  140. }
  141. // zpb_begin UserClasses 
  142. // zpb_end 
  143.  
  144. Listing Two
  145. /*
  146.     This class is a basic extension of the Applet class.  It would generally be
  147.     used as the main class with a Java browser or the AppletViewer.  But an instance
  148.     can be added to a subclass of Container.  To use this applet with a browser or
  149.     the AppletViewer, create an html file with the following code:
  150.  
  151.     <HTML>
  152.     <HEAD>
  153.     <TITLE>SampleGenCode window</TITLE>
  154.     </HEAD>
  155.     <BODY>
  156.  
  157.     <APPLET CODE="SampleGenCode.class" WIDTH=332 HEIGHT=169></APPLET>
  158.  
  159.     </BODY>
  160.  
  161.     </HTML>
  162.  
  163.     You can add controls to Simple with Cafe Studio.
  164.     (Menus can be added only to subclasses of Frame.)
  165.  */
  166.  
  167. import java.awt.*;
  168.  
  169. public class SampleGenCode extends java.applet.Applet {
  170.  
  171.     public void init() {
  172.  
  173.         //{{INIT_CONTROLS
  174.         setLayout(null);
  175.         addNotify();
  176.         resize(insets().left + insets().right + 380, insets().top + insets().bottom + 281);
  177.         panel1=new Panel();
  178.         panel1.setLayout(null);
  179.         add(panel1);
  180.         panel1.reshape(insets().left + 49,insets().top + 128,203,75);
  181.         group1= new CheckboxGroup();
  182.         button1=new Button("Button");
  183.         add(button1);
  184.         button1.reshape(insets().left + 14,insets().top + 15,88,26);
  185.         label1=new Label("Label");
  186.         add(label1);
  187.         label1.reshape(insets().left + 126,insets().top + 15,70,105);
  188.         check1=new Checkbox("Radio button",group1, false);
  189.         add(check1);
  190.  
  191.         check1.reshape(insets().left + 231,insets().top + 60,105,38);
  192.         check2=new Checkbox("Radio button",group1, false);
  193.         panel1.add(check2);
  194.         check2.reshape(42,30,105,18);
  195.         //}}
  196.  
  197.         super.init();
  198.     }
  199.  
  200.     public boolean handleEvent(Event event) {
  201.         return super.handleEvent(event);
  202.     }
  203.  
  204.     //{{DECLARE_CONTROLS
  205.     Panel panel1;
  206.     CheckboxGroup group1;
  207.     Button button1;
  208.     Label label1;
  209.     Checkbox check1;
  210.     Checkbox check2;
  211.     //}}
  212.  
  213. }
  214.  
  215.  
  216. Listing Three
  217. import java.util.Vector;
  218. import java.applet.Applet;
  219. import java.awt.*;
  220. import java.util.Hashtable;
  221. import opusmeta.*;
  222. import opusjava.*;
  223. /******************************************************************************\
  224. **                                                                            **
  225. **  (C) Copyright 1996 by Autodesk, Inc.                                      **
  226. **                                                                            **
  227. **  The information contained herein is confidential, proprietary             **
  228. **  to Autodesk,  Inc.,  and considered a trade secret as defined             **
  229. **  in section 499C of the penal code of the State of California.             **
  230. **  Use of  this information  by  anyone  other  than  authorized             **
  231. **  employees of Autodesk, Inc.  is granted  only under a written             **
  232. **  non-disclosure agreement,  expressly  prescribing  the  scope             **
  233. **  and manner of such use.                                                   **
  234. **                                                                            **
  235. \******************************************************************************/
  236.  
  237. /******************************************************************************\
  238. **                                                                            **
  239. **  This Java source file contains machine generated code which               **
  240. **  will instantiate a HyperWire object network in Javaese.  Because          **
  241. **  the code is generated procedurally within HyperWire, it might appear      **
  242. **  somewhat odd (repetitive, cryptic, etc.).                                 **
  243. \******************************************************************************/
  244.  
  245.  
  246.  
  247. final public class Hyperwire extends OpusApplet
  248.   {
  249.   Hashtable plugInMetaData = new Hashtable();
  250.  
  251. /******************************************************************************\
  252. **                                                                            **
  253. **  The following are the resetting methods.  There is one method             **
  254. **  for each module instance.  The method is called when the                  **
  255. **  module is initialized and whenever the module needs to be                 **
  256. **  reset.  These are NOT public methods.  To reset a module                  **
  257. **  from the plug-in, or wherever, call the public                            **
  258. **  resetModule( Nodule aModule ) method with the module                      **
  259. **  you want to reset.